package com.rub.prajna.core

import com.rub.prajna.bootstrap.utils.GifDecoder
import javafx.embed.swing.SwingFXUtils
import javafx.scene.image.Image
import javafx.scene.image.ImageView

class AnimatedGif(filename: String?, durationMs: Double, imageView: ImageView) : Animation() {
    init {
        val d = GifDecoder()
        d.read(filename)
        var images = ArrayList<Image?>(d.frameCount)
        for (i in 0 until d.frameCount) {
            images.add(SwingFXUtils.toFXImage(d.getFrame(i), null))
        }
        super.init(images, durationMs, imageView)
    }
}